package LinkedHashSet;

import lx.Student;


import java.util.HashSet;
import java.util.LinkedHashSet;

public class demo1 {
    public static void main(String[] args) {

        Student s1 = new Student("张三", 8);


        Student s2 = new Student("张三", 8);
        Student s3 = new Student("李四", 18);
        Student s4 = new Student("王五", 17);
        LinkedHashSet<Student> set = new LinkedHashSet<Student>();
        set.add(s3);
        set.add(s1);
        set.add(s3);
        set.add(s4);
        //LinkedHashSet的存和去顺序一样
        for (Student student : set) {

            System.out.println(student);
        }

    }
}
